import React from "react";
import ReactDom from "react-dom";

class List extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      numa:0,
      numb:0
    }
    this.clickHandle = this.clickHandle.bind(this);
  }

  clickHandle(type){
    switch (type) {
      case "a":
        this.setState({numa:this.state.numa+1});
        break;
      case "b":
        this.setState({numb:this.state.numb+1});
        break;
      default:

    }
  }

  render(){
    return <ul>
      <li>{this.state.numa}</li>
      <li>{this.state.numb}</li>
      <li onClick={()=>this.clickHandle('a')}>aaa</li>
      <li onClick={()=>this.clickHandle('b')}>bbb</li>
    </ul>
  }
}

ReactDom.render(<List />,document.body);
